package com.le.tester.book.concurrentchallenge.synchronizedUtil14;

/**
 * createTime：2025-05-20 11:22
 * description：当前提条件不满足时，有界缓存不会执行相应的操作
 */
public class GrumpyBoundedBuffer<V> extends BaseBoundedBuffer<V> {
    public GrumpyBoundedBuffer(int size) {
        super(size);
    }

    //    状态控制
    public synchronized void put(V v) {
        if (isFull()) {
            throw new RuntimeException();
        }
        doPut(v);
    }

    public synchronized V take() {
        if (isEmpty()) {
            throw new RuntimeException();
        }
        return doTake();
    }
}
